package com.penghaisoft.microwms.product.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.penghaisoft.microwms.common.dto.Resp;
import com.penghaisoft.microwms.common.page.Pager;
import com.penghaisoft.microwms.common.service.BaseService;
import com.penghaisoft.microwms.common.wms.model.ProStorageSnChkHis;
import com.penghaisoft.microwms.product.dao.ProStorageSnChkHisMapper;
import com.penghaisoft.microwms.product.service.IProStorageSnChkHisService;

/** 
* @ClassName: ProStorageSnChkHisServiceImpl 
* @Description: 成品条码质检历史表
* @author luoteng
* @date 2018年10月26日 下午4:28:54  
*/
@Service("proStorageSnChkHisService")
public class ProStorageSnChkHisServiceImpl extends BaseService implements IProStorageSnChkHisService{
		@Resource
		private ProStorageSnChkHisMapper proStorageSnChkHisMapper;
		
	  /**
	   * 新增记录
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp create(ProStorageSnChkHis proStorageSnChkHis){
			proStorageSnChkHisMapper.create(proStorageSnChkHis);
			return success();
		}

	  /**
	   * 删除记录（逻辑删除）
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp delete(ProStorageSnChkHis proStorageSnChkHis){
			proStorageSnChkHisMapper.delete(proStorageSnChkHis);
			return success();
		}
		
	  /**
	   * 查询列表
	   * @param pager
	   * @param baseResource
	   * @return
	   */
		@Override
		public Pager<ProStorageSnChkHis> findListByCondition(int page, int rows,ProStorageSnChkHis condition){
		    Pager<ProStorageSnChkHis> pager = new Pager<>();
		    pager.setPage(page);
		    pager.setRows(rows);
    		condition.preQuery();
    		long size = proStorageSnChkHisMapper.queryCount(condition);
    		List<ProStorageSnChkHis> records = new ArrayList<ProStorageSnChkHis> ();
    		if(size > 0){
    			records = proStorageSnChkHisMapper.queryList(pager,condition);
    		}
			pager.setRecords(records);
			pager.setTotalCount(size);
			return pager;
		}

	  /**
	   * 查询单条
	   * @param id
	   * @return
	   */
		@Override
		public ProStorageSnChkHis findById(String id){
			return proStorageSnChkHisMapper.queryById(id);
		}
		
	  /**
	   * 修改记录
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp update(ProStorageSnChkHis proStorageSnChkHis){
			proStorageSnChkHisMapper.updateBySelect(proStorageSnChkHis);
			return success();
		}

}
